package com.multidisplay.controller;

import com.multidisplay.bo.ResultBo;
import com.multidisplay.po.LoginLog;
import com.multidisplay.po.VisitorLog;
import com.multidisplay.service.impl.LogServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class LogController {
    @Autowired
    private LogServiceImpl logService;

    @PostMapping("/visitorLog")
    public void visitorLog(VisitorLog visitorLog){
        logService.visitorLog(visitorLog);
    }

    @PostMapping("/loginLog")
    public void loginLog(HttpServletRequest request){
        logService.loginLog(request);
    }

    @PostMapping("/queryOfLogin")
    public ResultBo<LoginLog> queryOfLogin(int page, int limit){
        return logService.queryOfLogin(page, limit);
    }

    @PostMapping("/queryPfPage")
    public ResultBo<VisitorLog> queryOfPage(int page, int limit){
        return logService.queryOfPage(page, limit);
    }

    @PostMapping("/deleteLogin")
    public void deleteLogin(LoginLog loginLog){
        logService.deleteLogin(loginLog);
    }

    @PostMapping("/deletePage")
    public void deletePage(VisitorLog visitorLog){
        logService.deletePage(visitorLog);
    }
}
